#!/usr/bin/env bash
set -e

JOB_PATH="/var/vcap/jobs/director"

# Anything placed in the BBR_ARTIFACT_DIRECTORY by the backup script will be available to the restore script at restore time.
# The BBR CLI is responsible for setting the BBR_ARTIFACT_DIRECTORY
BBR_ARTIFACT_FILE_PATH="${BBR_ARTIFACT_DIRECTORY}/bosh-director-artifact-file"
CONFIG_PATH="${JOB_PATH}/config/bbr.json"

"/var/vcap/jobs/database-backup-restorer/bin/restore" --config "${CONFIG_PATH}" --artifact-file "${BBR_ARTIFACT_FILE_PATH}"
